package per.chenxin.util.tcp.http;

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

public class TestSimpleProxy {
	// static String strCheckUrl = "http://www.google.com";
	static String strCheckUrl = "http://www.google.com";
	static String proxyHost = "cyr.dip.jp";
	static int proxyPort = 443;

	// static String strCheckUrl = "http://cyr.dip.jp:4711/login.php";
	/**
	 * @param args
	 * @throws IOException 
	 * @throws UnknownHostException 
	 */
	public static void main(String[] args) throws UnknownHostException, IOException {

		ProxyEntity proxyEntity = ProxyEntity.getNewProxyEntity();
		proxyEntity.setProxyHost(proxyHost);
		proxyEntity.setProxyPort(proxyPort);

		Socket socket = new Socket(proxyEntity.getProxyHost(),
				proxyEntity.getProxyPort());

		for (Entity entity : proxyEntity.listEntity) {
			HttpUtil.socketConnect(socket, entity.getProxyHost(),
					entity.getProxyPort(), entity.getAuthorization());
		}

		System.out.println(new String(HttpUtil.getMethod(strCheckUrl,
				proxyEntity)));

	}

}
